package com.steak.concurrent.queue;

import java.util.ArrayList;
import java.util.concurrent.LinkedBlockingQueue;

/**
 * 功能说明：
 * <p>
 * Original @Author: steakliu-刘牌, 2022-09-04  18:38
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
public class LinkedBlockingQueueTest {

    private static final LinkedBlockingQueue<String> linkedBlockingQueue = new LinkedBlockingQueue<>();

    static {
        try {
            linkedBlockingQueue.put("liu");
            linkedBlockingQueue.put("pai");
            linkedBlockingQueue.put("pai2");
            linkedBlockingQueue.put("pai3");
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    public static void main(String[] args) {
        while (true){
            System.out.println(linkedBlockingQueue.poll());
            if (linkedBlockingQueue.size() == 0){
                break;
            }
        }

    }
}
